#发生错误时跳转到错误页：235
#导入重定向模块redirect
from flask import Flask, render_template,request,redirect
app=Flask(__name__)
@app.route("/search4",methods=['post','get'])
def do_search() -> 'html':
    #从请求的表单中取字段
    phrase = request.form['phrase']
    letters=request.form['letters']
    title = '这是搜索结果的title'
    results = str(search4letters(phrase, letters))
    return render_template('result.html',
                           the_phrase=phrase,#传值给渲染模版方式，key=
                           the_letters=letters,
                           the_title=title,
                           the_result=results,)
@app.route("/")
@app.route("/entry")
def entry_page() -> 'html':
    return render_template('entry.html',the_title='WWH标题1')

def search4letters(strA:str, strB:str)->set:
    """查找字符串B中包含字符串A中的字母的集合"""
    return set(strA).intersection(set(strB))
app.run(debug=True)